package com.example.hibernate.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.List;

/**
 * Created by Yasin H on 2018/7/30.
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity(name = "user")
public class User extends AbstractEntity {

    public enum Sex {
        MALE, FEMALE
    }

    private String username;
    @Enumerated(EnumType.STRING)
    private Sex sex;
    @OneToMany(mappedBy = "user",
            cascade = CascadeType.ALL,
            fetch = FetchType.LAZY)
    private List<Address> address;

}
